package com.aop;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;

import java.util.Arrays;

public class MyAspect {
    public void a(){
        System.out.println("aaaaaa");
    }
    public void before(){
        System.out.println("前置通知");
    }
    public void after() {
        System.out.println("后置通知");
    }
    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("环绕通知");
        Object[] args = joinPoint.getArgs();
        System.out.println("原方法执行");
        Object proceed = joinPoint.proceed(args);
        System.out.println("环绕通知");
        return proceed;
    }
    public void afterThrowing(Exception e1) {
        System.out.println(e1);
    }
    public void returning(JoinPoint joinPoint, Object result) throws Throwable {
        System.out.println(Arrays.toString(joinPoint.getArgs()));
        System.out.println(result);
    }
}
